// 设备相关接口
import request from '../service/service';

/**
 * 获取塔机设备列表（塔机黑匣子数据获取）
 * @param data {Object} 请求参数(无)
 */
export function getCraneDeviceList(data) {
  return request({
    protocol: 'black_box/get_crane_device_list',
    options: data
  });
}

/**
 * 获取塔机数据列表（塔机黑匣子数据获取）
 * @param data {Object} 请求参数
 * crane_id:"1", 塔机设备的id,必填
 * day:"2020-12-29", 日期,必填，(2020-12-29)
 * page: "0"//页码，必填
 */
export function getCraneRecordList(data) {
  return request({
    protocol: 'black_box/get_crane_record_list',
    options: data
  });
}

/**
 * 获取计划集合
 */
export function getMachPlanList(data) {
  return request({
    protocol: '/bus/mach/plan/findPage',
    options: data,
    method: 'get'
  });
}

/**
 * 计划保存
 */
export function planSave(data) {
  return request({
    protocol: '/bus/mach/plan/planSave',
    options: data,
    method: 'post'
  });
}

/**
 * 获取设备计划明细导入模板
 */
export function getDevicePlanTmp(data) {
  return request({
    protocol: '/bus/mach/plan/getUploadTemplate',
    options: data,
    method: 'get'
  });
}

/**
 * 设备计划明细数据导入
 */
export function uploadDeviceExcel(data) {
  return request({
    protocol: '/bus/mach/plan/uploadExcel',
    options: data,
    method: 'formData',
    requestConfig: {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
      }
    }
  });
}

/**
 * 根据明细id删除明细
 */
export function deletePlanDetail(data) {
  return request({
    protocol: '/bus/mach/plan/deleteByDetailId',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 根据计划id获取计划详情
 */
export function getPlanDetail(data) {
  return request({
    protocol: '/bus/mach/plan/findById',
    options: data,
    method: 'get'
  });
}

/**
 * 计划审核
 */
export function planReward(data) {
  return request({
    protocol: '/bus/mach/plan/planReward',
    options: data,
    method: 'post'
  });
}

/**
 * 根据id删除计划
 */
export function deleteDevicePlan(data) {
  return request({
    protocol: '/bus/mach/plan/deleteById',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 获取特种设备列表
 */
export function getSpecialList(data) {
  return request({
    protocol: '/bus/mach/tsg/findPage',
    options: data,
    method: 'get'
  });
}

/**
 * 新增特种设备
 */
export function addSpecial(data) {
  return request({
    protocol: '/bus/mach/tsg/create',
    options: data,
    method: 'post'
  });
}

/**
 * 删除特种设备
 */
export function delSpecial(data) {
  return request({
    protocol: '/bus/mach/tsg/deleteByIds',
    options: data,
    method: 'delete'
  });
}

/**
 * 修改特种设备
 */
export function updateSpecial(data) {
  return request({
    protocol: '/bus/mach/tsg/update',
    options: data,
    method: 'post'
  });
}

/**
 * 抄送人已读消息
 */
export function readMsgById(data) {
  return request({
    protocol: '/bus/mach/tsg/readMsgById',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 根据Id 查询特种设备详情
 */
export function getSpecialDetail(data) {
  return request({
    protocol: '/bus/mach/tsg/findById',
    options: data,
    method: 'get'
  });
}

/**
 * 查询普通设备列表
 */
export function getGenelList(data) {
  return request({
    protocol: '/bus/mach/genel/findPage',
    options: data,
    method: 'get'
  });
}

/**
 * 新增普通设备
 */
export function addGenel(data) {
  return request({
    protocol: '/bus/mach/genel/create',
    options: data,
    method: 'post'
  });
}

/**
 * 删除普通设备
 */
export function delGenel(data) {
  return request({
    protocol: '/bus/mach/genel/deleteByIds',
    options: data,
    method: 'delete'
  });
}

/**
 * 修改普通设备
 */
export function updateGenel(data) {
  return request({
    protocol: '/bus/mach/genel/update',
    options: data,
    method: 'post'
  });
}

/**
 * 普通设备抄送人已读消息
 */
export function genelReadMsg(data) {
  return request({
    protocol: '/bus/mach/genel/readMsgById',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 根据类型获取个人消息
 */
export function getTsgPageByType(data) {
  return request({
    protocol: '/bus/mach/tsg/getTsgPageByType',
    options: data,
    method: 'get'
  });
}

/**
 * 维护记录分页列表
 */
export function getMaintainList(data) {
  return request({
    protocol: '/bus/mach/tsg/maintainFindPage',
    options: data,
    method: 'get'
  });
}
